<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>一键微博设置</title>
<script type="text/javascript" src="chrome_ex_oauthsimple.js"></script>
<script type="text/javascript" src="chrome_ex_oauth.js"></script>
<script type="text/javascript" src="auth.js"></script>
<script type="text/javascript">

var oauth=ChromeExOAuth.initBackgroundPage({
	'request_url': "http://api.t.sina.com.cn/oauth/request_token",
	'authorize_url': "http://api.t.sina.com.cn/oauth/authorize",
	'access_url': "http://api.t.sina.com.cn/oauth/access_token",
	'consumer_key':"3640942651",
			'consumer_secret': "2d5ce5527431c7ee3670f94de918d248",
			'scope':'',
			'app_name': "微博表情"
});	

function getTimeLine(since_id, callback)
{
    	 var url = "http://api.t.sina.com.cn/statuses/friends_timeline";
	 var userid=oauth.getUserId();
	  var request = {
	    'method': 'get',
	    'parameters':{
	    	'user_id':userid,
	    	'since_id':since_id,
	    	'count':1
	    }
	  };

	  oauth.sendSignedRequest(url, callback, request);

}

function displayTimeLine(response)
{
    return response;
}

chrome.extension.onRequest.addListener(onRequest);
    function onRequest(request, sender, callback) {
    
        switch(request.action)
        {
            case "getNewFeed":
                getTimeLine(request.since_id, callback);
                break;
        }
    };
	
</script>
</head>
<body>

</body>
</html>